-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `UpdateProfileUser`(IN p_profId BIGINT,IN p_firstName VARCHAR(45) , IN p_lastName VARCHAR(45),IN p_address TEXT,IN p_birthDate TIMESTAMP,IN p_gender VARCHAR(10),IN p_isDeath VARCHAR(10),IN p_deathDt TIMESTAMP,IN p_socialStatus VARCHAR(10),IN p_acadimicQual VARCHAR(10),IN p_country VARCHAR(45),IN p_city VARCHAR(45),IN p_blodType VARCHAR(10),IN p_religion VARCHAR(10),IN p_image MEDIUMBLOB,IN p_imageType VARCHAR(45))
BEGIN
if(p_imageType != '-1')Then

UPDATE `profiles`
SET
`firstName` =p_firstName,
`lastName`=p_lastName,
`address`=    p_address,
`birthDate`=p_birthDate,
`gender`=p_gender,
`isDeath`=p_isDeath,
`deathDt`=p_deathDt,
`socialStatus`=p_socialStatus,
`acadimicQual`=p_acadimicQual,
`country`=p_country,
`city`=p_city,
`blodType`=p_blodType,
`religion` =p_religion,
`image` =p_image,
`imageType` =p_imageType

WHERE `profId` = p_profId;
ELSE
UPDATE `profiles`
SET
`firstName` =p_firstName,
`lastName`=p_lastName,
`address`=    p_address,
`birthDate`=p_birthDate,
`gender`=p_gender,
`isDeath`=p_isDeath,
`deathDt`=p_deathDt,
`socialStatus`=p_socialStatus,
`acadimicQual`=p_acadimicQual,
`country`=p_country,
`city`=p_city,
`blodType`=p_blodType,
`religion` =p_religion

WHERE `profId` = p_profId;

END IF;
END
